﻿<my:Container x:Class="Net.Chirash.Twitter.TweetZone.WindowComponents.Containers.ChartContainer"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:my="clr-namespace:Net.Chirash.Twitter.TweetZone.WindowComponents.Containers"
             xmlns:system="clr-namespace:System;assembly=mscorlib"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="400" xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit">
    <UserControl.Resources>
        <my:DateTimeElementValueConverter x:Key="DtConverter" />
    </UserControl.Resources>
    <DockPanel>
        <Grid DockPanel.Dock="Top">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Label Content="Year" />
            <Label Content="Month" Grid.Column="1" />
            <Label Content="Day" Grid.Column="2" />
            <Label Content="Hour" Grid.Column="3" />
            <Label Content="Grouping" Grid.Column="4" />
            <ComboBox Name="YearComboBox" SelectedIndex="0" SelectionChanged="ComboBox_SelectionChanged"
                      SelectedValue="{Binding Path=Year, Converter={StaticResource DtConverter}, Mode=TwoWay}" Grid.Row="1" IsEnabled="False">
                <system:String>All</system:String>
            </ComboBox>
            <ComboBox Name="MonthComboBox" SelectedIndex="0" SelectionChanged="ComboBox_SelectionChanged"
                      SelectedValue="{Binding Path=Month, Converter={StaticResource DtConverter}, Mode=TwoWay}" Grid.Column="1" Grid.Row="1">
                <system:String>All</system:String>
            </ComboBox>
            <ComboBox Name="DayComboBox" SelectedIndex="0" SelectionChanged="ComboBox_SelectionChanged"
                      SelectedValue="{Binding Path=Day, Converter={StaticResource DtConverter}, Mode=TwoWay}" Grid.Column="2" Grid.Row="1">
                <system:String>All</system:String>
            </ComboBox>
            <ComboBox Name="HourComboBox" SelectedIndex="0" SelectionChanged="ComboBox_SelectionChanged"
                      SelectedValue="{Binding Path=Hour, Converter={StaticResource DtConverter}, Mode=TwoWay}" Grid.Column="3" Grid.Row="1">
                <system:String>All</system:String>
            </ComboBox>
            <ComboBox Name="GroupingComboBox" SelectedIndex="0" SelectionChanged="ComboBox_SelectionChanged"
                      SelectedValue="{Binding Path=GroupBy, Mode=OneWayToSource}" Grid.Column="4" Grid.Row="1">
                <system:String>Year</system:String>
                <system:String>Month</system:String>
                <system:String>Day</system:String>
                <system:String>Hour</system:String>
            </ComboBox>
        </Grid>
        <chartingToolkit:Chart Name="Chart1" LegendStyle="{StaticResource ButtonFocusVisual}">
            <chartingToolkit:BarSeries Name="BarSeries1" ItemsSource="{Binding Collection}" IndependentValueBinding="{Binding Path=Index}" DependentValueBinding="{Binding Path=Value}">
                <chartingToolkit:BarSeries.IndependentAxis>
                    <chartingToolkit:CategoryAxis Orientation="Y" ShowGridLines="True" Name="CategoryAxis1" Title="{Binding GroupBy}" SortOrder="Descending" />
                </chartingToolkit:BarSeries.IndependentAxis>
                <chartingToolkit:BarSeries.DependentRangeAxis>
                    <chartingToolkit:LinearAxis Orientation="X" ShowGridLines="True" Title="# of Tweets" Minimum="0" />
                </chartingToolkit:BarSeries.DependentRangeAxis>
            </chartingToolkit:BarSeries>
        </chartingToolkit:Chart>
    </DockPanel>
</my:Container>
